﻿using Core.Info;
using Core.Utility.Helper;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Utility.Security
{
    /// <summary>
    /// Api签名信息
    /// </summary>
    public class ApiSignatureInfo
    {
        private string? signature;

        /// <summary>
        /// 
        /// </summary>
        public ApiSignatureInfo()
        {            
            Nonce = ApiSecurity.GenerateNonce();
            TimeStamp = AppTime.NowUnixTime;
        }

        /// <summary>
        /// 随机字符串
        /// </summary>
        public string? Nonce { get; private set; }

        /// <summary>
        /// 时间戳
        /// </summary>
        public long? TimeStamp { get; private set; }

        /// <summary>
        /// 签名
        /// </summary>
        public string? Signature
        {
            get => signature;
            private set => signature = value;
        }

        /// <summary>
        /// 设置签名字符串
        /// </summary>
        /// <param name="signature"></param>
        public void SetSignature(string? signature)
        {
            Signature = signature;
        }
    }
}
